package
{
	import as3isolib.display.IsoSprite;
	import as3isolib.geom.Pt;
	import as3isolib.utils.IsoDrawingUtil;
	
	import flash.display.Sprite;
	import flash.geom.Vector3D;

	public class PathVector
	{
		public var startNode:PathNode;
		public var endNode:PathNode;
		
		public function PathVector(startNode:PathNode, endNode:PathNode)
		{
			this.startNode = startNode;
			this.endNode = endNode;
		}
		
		public function getLength():Number{
			return this.startNode.v3.subtract(this.endNode.v3).length;
		}
		
		public function getDegrees():Number{
			return (180 / Math.PI) * Math.atan2(- this.startNode.v3.y + this.endNode.v3.y, -this.startNode.v3.x + this.endNode.v3.x);
		}
		
		public function createIsoSprite():IsoSprite{
			var isoSprite:IsoSprite = new IsoSprite();
			var line:Sprite = new Sprite();
			
			isoSprite.container.addChild(line);
			isoSprite.x = this.startNode.v3.x;
			isoSprite.y = this.startNode.v3.y;
			
			isoSprite.setSize(1, this.getLength(), 0);
			
			line.graphics.clear();
			line.graphics.beginFill(0);
			IsoDrawingUtil.drawIsoArrow(line.graphics, new Pt(-1,-1, 0), this.getDegrees(), this.getLength(), 1, "xy")
			line.graphics.endFill();
			
			return isoSprite;
		}
	}
}